package com.jida.tijian.controller;

import com.jida.tijian.domain.Users;
import com.jida.tijian.dto.ResponseObject;
import com.jida.tijian.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 处理用户模块请求的控制器
 */
@RestController //@Controller+@ResponseBody 所以后端接口给回前端的数据也都是json对象

public class UserController {
    @Autowired
    UsersService usersService;//声明接口，不能声明实现类

    /**
     * 定义处理登录请求的方法
     */
/**
    public Users login(Users users) {
        Users u=null;

        //调用service
        return u;
    }
 */

    @RequestMapping("/login") //http://localhost:8080/login
    public ResponseObject<Users> login(@RequestBody Users users){
        //System.out.println("Users"+users.getUserId()+","+users.getPassword());
        //controller-->service-->Mapper
        //1.根据手机号查询用户，看有没有，

        //Users u=users;
        ResponseObject<Users> responseObject = usersService.login(users);

       // ResponseObject<Users> responseObject = new ResponseObject<>(200,"成功",u);

        return responseObject;
    }
    /**
     * 定义处理注册请求的方法
     */

    /**
     * 定义处理修改密码请求的方法
     */

    /**
     * 定义处理快捷登录请求的方法
     */


}
